<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    function ArrayIterator() {
        let index = 0
        return {
            next: () => {
                if (index === this.length) {
                    return {value: undefined, done: true}
                }else {
                    const arrObj = {value: this[index] + 10, done: false}
                    index ++
                    return arrObj
                }
            }
        }
    }

    Array.prototype[Symbol.iterator] = ArrayIterator

    for (const arrayElement of [1,3,5,7,9,11]) {
        console.log(arrayElement)
    }

    // const next = ArrayIterator([1,2,3,4,5,6,7])
    //
    // var arrObj = undefined
    // do {
    //     arrObj = next()
    //     console.log(arrObj)
    // }while (!arrObj.done)
</script>
</html>